import 'package:flutter/material.dart';
import 'package:happy_elf_app/utils/color.dart';
import '../../utils/adaption.dart';

class BaseStyle {
  static String backgroundColor = '#f8f8f8'; //背景色
  static String backgroundColor2 = '#fbfbfb'; //背景色
  static String startGradientColor = '#FFDDA7'; //渐变初始色
  static String endGradientColor = '#ECC786'; //渐变结束色
  static String startGradientRedColor = '#E85751'; //渐变初始色
  static String endGradientRedColor = '#E22227'; //渐变结束色
  static String white = '#ffffff';
  static String black = '#000000';
  static String gray = '#646D78';
  static String gray2 = '#CBCBCB';
  static String gray3 = '#DBDBDB';
  static String graya = '#AAAAAA';
  static String blue = '#3974EA';
  static String bluee7 = '#2A68E7';
  static String orange = '#F48000';
  static String orange00 = '#FF9300';
  static String green = '#5AD885';
  static String red = '#D01837';
  static String red36 = '#F04136';
  static String redAF = '#ECA2AF';
  static String black3 = '#333333';
  static String black6 = '#666666';
  static String black7 = '#777777';
  static String black9 = '#999999';
  static String inputDecorationColor = '#BDC1C9';
  static String borderColor = "#f3f3f3";
  static String borderColor2 = "#EBEDF0";
  static String borderColor3 = "#FBFBFC";
  static String borderColorF7 = '#F5F6F7';
  static String tagColor1 = '#3465E7';
  static String tagColor2 = '#B6BDCF';
  static String tagColor3 = '#A36635';
  static String black2 = '#253240';
  static String green5d = '#5DC780';
  static String borderColorE1 = '#D8D8D8';
  static String tipsFontColor = '#C3161C';
  static String tipsBgColor = '#FFE9E9';
  static String inputTextColor = '#131314';
  static String inputLabelColor = '#394259';
  static String inputHelperColor = '#969799';

  //字体大小
  static double fs24 = 24.fpx;
  static double fs20 = 20.fpx;
  static double fs18 = 18.fpx;
  static double fs17 = 17.fpx;
  static double fs16 = 16.fpx;
  static double fs15 = 15.fpx;
  static double fs14 = 14.fpx;
  static double fs13 = 13.fpx;
  static double fs12 = 12.fpx;
  static double fs11 = 11.fpx;
  static double fs10 = 10.fpx;
  static double fs9 = 9.fpx;
  static double fs8 = 8.fpx;

  // 字号12  行高17
  static TextStyle style12(_hexColor, [isBold = false, double alpha = 1]) {
    return TextStyle(
        fontSize: BaseStyle.fs12,
        fontWeight: isBold ? FontWeight.bold : FontWeight.w400,
        color: hexColor(_hexColor, alpha),
        height: 1.416);
  }

  // 字号14  行高20
  static TextStyle style14(_hexColor, [isBold = false, double alpha = 1]) {
    return TextStyle(
        fontSize: BaseStyle.fs14,
        fontWeight: isBold ? FontWeight.bold : FontWeight.w400,
        color: hexColor(_hexColor, alpha),
        height: 1.428);
  }

  // 字号16  行高22
  static TextStyle style16(_hexColor, [isBold = false, double alpha = 1]) {
    return TextStyle(
        fontSize: BaseStyle.fs16,
        fontWeight: isBold ? FontWeight.bold : FontWeight.w400,
        color: hexColor(_hexColor, alpha),
        height: 1.375);
  }

  // 字号18  行高25
  static TextStyle style18(_hexColor, [isBold = false, double alpha = 1]) {
    return TextStyle(
        fontSize: BaseStyle.fs18,
        fontWeight: isBold ? FontWeight.bold : FontWeight.w400,
        color: hexColor(_hexColor, alpha),
        height: 1.388);
  }

  // 二次封装的单行省略Text，给了默认值
  static Widget textOverflowWidget(
    String text, {
    double? fontSize,
    FontWeight? weight,
    String? color,
    double? lineHeight,
    TextAlign? textAlign,
    TextOverflow? overflow,
    int? maxLines,
    TextStyle? style,
  }) {
    return Text(
      breakWord(text),
      overflow: overflow ?? TextOverflow.ellipsis,
      maxLines: maxLines ?? 1,
      textAlign: textAlign ?? TextAlign.left,
      style: style ??
          TextStyle(
            fontSize: fontSize ?? 14.px,
            fontWeight: weight ?? FontWeight.w400,
            height: lineHeight ?? 1.428,
            color: hexColor(color ?? "#131314"),
          ),
    );
  }

  //appbar样式
  static TextStyle titleStyleWhite = TextStyle(
      fontSize: fs17,
      color: hexColor(white),
      fontWeight: FontWeight.w600,
      height: 1.388);

  static TextStyle titleStyleBlack = TextStyle(
      fontSize: fs17,
      color: hexColor(black),
      fontWeight: FontWeight.w600,
      height: 1.388);

  // 输入框提示语样式
  static TextStyle inputDecorationStyle = TextStyle(
      fontSize: BaseStyle.fs14,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.inputDecorationColor),
      height: 1.428);
  // 输入框内容样式
  static TextStyle inputTextStyle = TextStyle(
      fontSize: BaseStyle.fs14,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.black, .85),
      height: 1.428);
  // 输入框加粗内容样式
  static TextStyle inputTextBoldStyle = TextStyle(
      fontSize: BaseStyle.fs14,
      fontWeight: FontWeight.bold,
      color: hexColor(BaseStyle.black, .85),
      height: 1.428);
  // 输入框提示语样式 16px
  static TextStyle inputHintStyle16 = TextStyle(
      fontSize: BaseStyle.fs16,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.black, 0.25),
      height: 1.375);

  // （申请用印）输入框内容样式 16px
  static TextStyle inputTextStyle16 = TextStyle(
      fontSize: BaseStyle.fs16,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.inputTextColor),
      height: 1.375);
  // （申请用印）输入框内容样式 Bold 16px
  static TextStyle inputTextStyleBold16 = TextStyle(
      fontSize: BaseStyle.fs16,
      fontWeight: FontWeight.bold,
      color: hexColor(BaseStyle.inputTextColor),
      height: 1.375);
  // （申请用印）输入框 label 16px
  static TextStyle inputLabelStyle = TextStyle(
      fontSize: BaseStyle.fs16,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.inputLabelColor),
      height: 1.375);
  // （申请用印）输入框 说明文字 14px
  static TextStyle inputHelperStyle = TextStyle(
      fontSize: BaseStyle.fs14,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.inputHelperColor),
      height: 1.428);

  // 登录页输入框提示语样式
  static TextStyle loginInputDecorationStyle = TextStyle(
      fontSize: BaseStyle.fs16,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.inputDecorationColor),
      height: 1.428);
  // 登录页输入框内容样式
  static TextStyle loginInputTextStyle = TextStyle(
      fontSize: BaseStyle.fs16,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.black, .85),
      height: 1.428);
  // 登录页输入框内容样式
  static TextStyle loginPwdInputTextStyle = TextStyle(
      fontSize: BaseStyle.fs12,
      fontWeight: FontWeight.w400,
      color: hexColor(BaseStyle.black, .85),
      height: 1.904);

  // 文字数字省略
  // 把每个字符插入一个0宽的字符，用以文本溢出省略和长单词截断
  static String breakWord(String word) {
    if (word.isEmpty) {
      return word;
    }
    String breakWord = '';
    word.runes.forEach((element) {
      breakWord += String.fromCharCode(element);
      breakWord += '\u200B';
    });
    return breakWord;
  }
}

//   static String backgroundColor = '#f5f8fe'; //背景色
//   static String startGradientColor = '#5581F1'; //渐变初始色
//   static String endGradientColor = '#1153FC'; //渐变结束色
//   static String white = '#ffffff';
//   static String black = '#000000';
//   static String gray = '#646D78';
//   static String blue = '#3974EA';
//   static String orange = '#F48000';
//   static String green = '#5AD885';
//   static String red = '#D01837';
//   static String black3 = '#333333';
//   static String black6 = '#666666';
//   static String black9 = '#999999';
//   static String inputDecorationColor = '##BDC1C9';
//   static String borderColor = "#f3f3f3";
//   static String tagColor1 = '#3465E7';
//   static String tagColor2 = '#B6BDCF';
//   static String black2 = '#253240';
//   static String green5d = '#5DC780';
//   static String borderColorE1 = '#E1E1E1';
//   static String tipsFontColor = '#5582F8';
//   static String tipsBgColor = '#E0EAFF';
